import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:lcapp/basic/user_info.dart';
import 'package:lcapp/model/popover/popover.dart';
import 'package:lcapp/routes/route.dart';

class EditInfoDialog extends StatefulWidget {
  const EditInfoDialog({Key? key}) : super(key: key);
  @override
  State<EditInfoDialog> createState() => _EditInfoDialogState();
}

class _EditInfoDialogState extends State<EditInfoDialog> {
  @override
  Widget build(BuildContext context) {
    return  Container(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Container(
            padding: EdgeInsets.symmetric(vertical: 60.w,horizontal: 60.w),
            margin: EdgeInsets.symmetric(horizontal: 80.w),
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(10.w)
            ),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Container(
                  child: Text('完善个人资料',style: TextStyle(
                      color: Color(0xff1A051D),
                      fontSize: 45.sp,
                      fontWeight: FontWeight.w500
                  ),),
                ),
                Container(
                  margin: EdgeInsets.only(top: 12.w,bottom: 40.w),
                  child: Text('让更多客户认识您',style: TextStyle(
                      color: Color(0xff1A051D),
                      fontSize: 26.sp,
                      fontWeight: FontWeight.w400
                  ),),
                ),
                Container(
                  height: 60.w,
                  margin: EdgeInsets.only(bottom: 12.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text('名称',style: TextStyle(
                        color: Color(0xff1A051D),
                        fontSize: 34.sp,
                        fontWeight: FontWeight.w500
                      ),),
                      SizedBox(width: 120.w,),
                      Image.asset(userInfo.name!=null&&userInfo.name!.isNotEmpty?'assets/home/edit_info_dh.png':'assets/home/edit_info_xh.png',width: 40.w,fit: BoxFit.fitWidth,),
                    ],
                  ),
                ),
                Container(
                  height: 60.w,
                  margin: EdgeInsets.only(bottom: 12.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text('介绍',style: TextStyle(
                          color: Color(0xff1A051D),
                          fontSize: 34.sp,
                          fontWeight: FontWeight.w500
                      ),),
                      SizedBox(width: 120.w,),
                      Image.asset(userInfo.profiles!=null&&userInfo.profiles!.isNotEmpty?'assets/home/edit_info_dh.png':'assets/home/edit_info_xh.png',width: 40.w,fit: BoxFit.fitWidth,),
                    ],
                  ),
                ),
                Container(
                  height: 60.w,
                  margin: EdgeInsets.only(bottom: 12.w),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text('地址',style: TextStyle(
                          color: Color(0xff1A051D),
                          fontSize: 34.sp,
                          fontWeight: FontWeight.w500
                      ),),
                      SizedBox(width: 120.w,),
                      Image.asset(userInfo.address!=null?'assets/home/edit_info_dh.png':'assets/home/edit_info_xh.png',width: 40.w,fit: BoxFit.fitWidth,),
                    ],
                  ),
                ),
                GestureDetector(
                  onTap: (){
                    SmartDialog.dismiss();
                    Navigator.of(ASRRoute.navigatorKey.currentContext!).pushNamed('MinEditInfoPage').then((value){
                      PopoverManager.getPops();
                    });
                  },
                  child: Container(
                    alignment: Alignment.center,
                    margin: EdgeInsets.only(top: 40.w),
                    width: 540.w,
                    height: 100.w,
                    decoration: BoxDecoration(
                        color: Color(0xffFA6E28),
                        borderRadius: BorderRadius.circular(4.w)
                    ),
                    child: Text('去完善',style: TextStyle(
                        color: Colors.white,
                      fontSize: 35.sp,
                      fontWeight: FontWeight.w400
                    ),),
                  ),
                ),
              ],
            ),
          ),
          SizedBox(height: 70.w,),
          GestureDetector(
            onTap: (){
              SmartDialog.dismiss();
              PopoverManager.getPops();
            },
            child: Container(
              decoration: BoxDecoration(
                border: Border.all(color: Colors.white,width: 1),
                borderRadius: BorderRadius.circular(50.w),
              ),
              child: Icon(Icons.close,color: Colors.white,size: 50.sp,),
            ),
          ),
        ],
      ),
    );
  }
}
